<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
<button class="add">+</button><input type="text" value=10><button class="sub">-</button>
<script type="text/javascript">
	let add = document.querySelector('.add')
	let sub = document.querySelector('.sub')
	let input = document.querySelector('input')
	add.addEventListener('click',function(){
		// console.log('1')
		input.value=+(input.value) + 1
	})
	sub.addEventListener('click',function(){
		// console.log('1')
		if(input.value > 0){
		input.value=+(input.value) - 1
	}
	})
</script>
</body>
</html>